package cn.wolfcode.luowowo.article.service.impl;

import cn.wolfcode.luowowo.article.domain.Region;
import cn.wolfcode.luowowo.article.mapper.RegionMapper;
import cn.wolfcode.luowowo.article.service.IRegionService;
import cn.wolfcode.luowowo.common.query.QueryObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.dubbo.config.annotation.Reference;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.remoting.rmi.RmiBasedExporter;

import java.util.List;
@Service
public class RegionServiceImpl implements IRegionService{

    @Autowired
    private RegionMapper regionMapper;

    @Override
    public void insert(Region record) {
        regionMapper.insert(record);
    }

    @Override
    public Region selectByPrimaryKey(Long id) {
        return regionMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Region> selectAll() {
        return regionMapper.selectAll();
    }

    @Override
    public PageInfo<Region> queryForList(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<Region> list = regionMapper.queryForList();
        return new PageInfo(list);
    }

    @Override
    public void updateByPrimaryKey(Region record) {
        regionMapper.updateByPrimaryKey(record);
    }
}
